#include "memory.h"

static void* allocateMemory(int sizeInBytes){
	void* memory = kmalloc(sizeInBytes,GFP_KERNEL);
	if(memory == NULL){
		printk("fw4 failed to allocate memory\n");
		r_cleanup();
		return NULL;
	}
	if(pointers == NULL){
		kfree (memory);
		printk("pointers[] is null \n");		
		return NULL;
	}
	memset(memory,0,sizeInBytes);
	pointers[pointersCount++] = memory;
	return memory;		 
}

static void releaseAllMemory(void){
	int i;
	for(i=0;i<pointersCount;i++){
		if(pointers[i]!=NULL)
			kfree(pointers[i]);
	}		
}

